#include<vector>
#include <iostream>
using namespace std;

   void quicksort(vector <int> &v, int first, int last){
    int i = first, j = last, x = v[(first + last) / 2];
 
    do {
        while (v[i] < x) i++;
        while (v[j] > x) j--;
 
        if(i <= j) {
            if (i < j) swap(v[i], v[j]);
            i++;
            j--;
        }
    } while (i <= j);
 
    if (i < last)
        quicksort(v, i, last);
    if (first < j)
        quicksort(v, first,j);
}

int main (int argc, char ** argu){

  vector <int> v;
  int j;

 while (1) {
  cout << "число" << endl;
  cin >>j;
  if (0==j) break;
  v.push_back(j);
 }

 quicksort(v,0,v.size()-1);

 for (int j=0; j < v.size(); j++){
  cout << v[j] << " ";
  }

 return 0;
}
